<!DOCTYPE html>
<html>
<head>
  <title>JSDec - Liulihaocai</title>
  <meta charset="utf-8"/>
  <link rel="icon" href="./favicon.ico" type="image/x-icon" />
  <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon"/>
  <link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
  <script src="https://cdn.jsdelivr.net/gh/liulihaocai/EasyCopy/copy.min.js"></script>
  <script src="https://cdn.bootcss.com/FileSaver.js/1.3.8/FileSaver.min.js"></script>
  <script src="./js/beautify.js"></script>
  <script src="./js/uglifyjs.js"></script>
  <script src="./js/dec.js"></script>
  <script src="./js/functions.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
  <link href="./css/font.css" rel="stylesheet">
</head>
<body>
<div id="app">
  <v-app id="inspire" class="saof">
      <v-navigation-drawer
        v-model="drawer"
        app
      >
      <v-list-item-group v-model="item" color="primary">
        <v-list  nav dense v-for="item in listitems">
          <template v-if="item.fg">
          <v-list-item v-on:click="item.onc">
            <v-list-item-icon>
              <v-icon v-text="item.icon"></v-icon>
            </v-list-item-icon>
            <v-list-item-content>
              <v-list-item-title v-text="item.text"></v-list-item-title>
            </v-list-item-content>
          </template>
          <template v-else>
            <v-subheader>{{ item.fgt }}</v-subheader>
            <v-divider></v-divider>
          </template>
      </v-list-item>
      </v-list>
      </v-list-item-group>
      </v-navigation-drawer>
      <v-app-bar
        app
        color="primary"
        dark
      >
        <v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
        <v-toolbar-title>JSDec</v-toolbar-title><v-spacer></v-spacer>
            <v-menu offset-y>
      <template v-slot:activator="{ on, attrs }">
        <v-btn color="#FFFFFF" dark v-bind="attrs" v-on="on" text><v-icon left>mdi-translate</v-icon>{{ lang.nowlang }}</v-btn>
      </template>
      <v-list>
        <v-list-item
          v-for="(item, index) in Langs"
          :key="index"
          @click="item.onc"
        >
          <v-list-item-title>{{ item.title }}</v-list-item-title>
        </v-list-item>
      </v-list>
    </v-menu>
      </v-app-bar>
      <v-main>
<template>
  <div style="height: 3%;"></div>
  <v-card max-width="95%" class="mx-auto">
    <v-alert dense v-if="lang.al.error" border="left" type="error" close-icon="mdi-close" dismissible>{{ lang.al.t }}</v-alert>
    <v-alert dense v-if="lang.al.info" border="left" type="info" close-icon="mdi-close" dismissible>{{ lang.al.t }}</v-alert>
    <v-alert dense v-if="lang.al.success" border="left" type="success" close-icon="mdi-close" dismissible>{{ lang.al.t }}</v-alert>
    <v-alert dense v-if="lang.al.warning" border="left" type="warning" close-icon="mdi-close" dismissible>{{ lang.al.t }}</v-alert>
  </v-card>
    <v-card class="mx-auto" max-width="95%" height="300px" outlined>
    <textarea placeholder="Put the encoded JavaScript in" id="needenc" class="codef" style="width: 100%;cursor: pointer;height: 300px;border: solid 0px;outline:none;resize: none;"></textarea>
  </v-card>
  <v-container>
<v-select 
  v-model="nowenc"
  label="Plz choose a type of progcess"
  :items="lang.enc"
 >
  <template
    slot="item" 
    slot-scope="data"
   >
      <v-list-tile-content>
        <v-list-tile-title v-html="data.item"></v-list-tile-title>
      </v-list-tile-content>
    </template>
</v-select>
    <v-btn class="ma-2" color="primary" v-on:click="sdec">{{ lang.startdec }}</v-btn><v-btn class="ma-2" color="primary" v-on:click="ujs">{{ lang.upload }}</v-btn><v-btn class="ma-2" color="primary" v-on:click="cres">{{ lang.copyres }}</v-btn><v-btn class="ma-2" color="primary" onclick="document.getElementById('encres').value='';document.getElementById('needenc').value=''">{{ lang.clearres }}</v-btn><v-btn class="ma-2" color="primary" v-on:click="dres">{{ lang.downres }}</v-btn>
    <v-menu offset-y>
      <template v-slot:activator="{ on, attrs }">
        <v-btn dark v-bind="attrs" v-on="on" color="primary">{{ lang.prores }}<v-icon>mdi-menu-down</v-icon></v-btn>
      </template>
      <v-list>
        <v-list-item
          v-for="(item, index) in progcesses"
          :key="index"
          @click="item.onc"
        >
          <v-list-item-title>{{ item.title }}</v-list-item-title>
        </v-list-item>
      </v-list>
    </v-menu>
  </v-container>
  <v-card
    class="mx-auto"
    max-width="95%"
    height="300px"
    outlined
  >
<textarea placeholder="Decode Result" id="encres" class="codef" style="width: 100%;cursor: pointer;height: 300px;border: solid 0px;outline:none;resize: none;"></textarea>
  </v-card>
  <div style="height:50px;"></div>
</template>
      </v-main>
      <v-footer
        color="primary"
        app
      >
    <span class="white--text">JSDec by liulihaocai</span>
    <v-spacer></v-spacer> 
        <span class="white--text">&copy; {{ fullyear }}</span>
      </v-footer>
    </v-app>
</div>
<div id="rcp"></div>
<input type="file" name="file" id="fileId" style="display: none;" />
<script>
    var vue= new Vue({
      el: '#app',
      vuetify: new Vuetify({theme:{themes:{light:{primary:"#F8A912",},},},}),
      data:{
        lang:thislang,
        drawer: false,
        fullyear: new Date().getFullYear(),
        item:0,
        sdec:function(){
          try{if(document.getElementById("needenc").value.replace(/ /g,"")==""){st('Failed!\n'+thislang.inputsth)}
          else if(vue.nowenc==vue.lang.enc[0]){stimer();st(autoscan(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[1]){stimer();st(js_beautify(document.getElementById("needenc").value,{unescape_strings:true}))}
          else if(vue.nowenc==vue.lang.enc[2]){stimer();st(UglifyJS.minify(document.getElementById("needenc").value).code)}
          else if(vue.nowenc==vue.lang.enc[3]){stimer();st(uneval(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[4]){stimer();st(aadecode(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[5]){stimer();st(jjdecode(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[6]){stimer();st(decjsf(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[7]){stimer();st(decsojson4(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[8]){stimer();st(decsojsonp(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[9]){stimer();st(obdec_default(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[10]){stimer();st(dec_list(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[11]){stimer();st(dec_sojsonv5_default(document.getElementById("needenc").value))}
          else if(vue.nowenc==vue.lang.enc[12]){stimer();st(dec_jsjiamiv6_default(document.getElementById("needenc").value))}
          }catch(e){st('Failed!\n'+e)}
        },
        cres:function(){
          rcp.copy(document.getElementById("encres").value)
        },
        ujs:function(){
          document.getElementById("fileId").click();
        },
        dres:function(){
          var blob = new Blob([document.getElementById("encres").value], {type: "text/plain;charset=utf-8"});saveAs(blob, "JSDec_"+rand_str(6)+".js")
        },
        nowenc:thislang.enc[0],
        listitems:[
        {fg:false,fgt:thislang.tools},
        {fg:true,icon:"mdi-home",text:thislang.jsdecode,onc:function(){location.href="./index.html"}},
        {fg:true,icon:"mdi-book",text:thislang.help,onc:function(){window.open("./help")}},
        {fg:false,fgt:thislang.about},
        {fg:true,icon:"mdi-history",text:thislang.updlog,onc:function(){location.href="./upd.html"}},
        // {fg:true,icon:"mdi-heart-flash",text:"赞助作者",onc:function(){location.href="./donate.html"}},
        {fg:true,icon:"mdi-github",text:thislang.gh,onc:function(){window.open("https://github.com/liulihaocai/JSDec")}},
        ],
        Langs:Wlangs,
        progcesses:[
        {title:thislang.p.beautify,onc:function(){stimer();st(js_beautify(document.getElementById("encres").value,{unescape_strings:true}))}},
        {title:thislang.p.uglify1,onc:function(){stimer();st(UglifyJS.minify(document.getElementById("encres").value,{compress:false}).code)}},
        {title:thislang.p.uglify2,onc:function(){stimer();st(UglifyJS.minify(document.getElementById("encres").value,{compress:{keep_fnames:true},mangle:{keep_fnames:true},keep_fnames:true,output:{beautify:true,ascii_only:true}}).code)}},
        ]
      }
    })
    var rcp=EasyCopy.create("rcp")
document.getElementById("fileId").addEventListener('change',
function() {
    var objFile = document.getElementById("fileId");
    var files = document.getElementById('fileId').files;
    if (files.length != 0) {
        var reader = new FileReader();
        reader.readAsText(files[0], "UTF-8");
        reader.onload = function(evt) {
            document.getElementById("needenc").value=evt.target.result;
        }
    }

})
  </script>
</body>
</html>